package com.code.day09.HashMap1;

import java.util.Collection;
import java.util.HashMap;

public class Demo1 {
    public static void main(String[] args) {
        HashMap<String, String> map = new HashMap<>();
        map.put("1", "1");
        map.put("2", "2");
        map.put("3", "3");
        map.put("4", "4");
        for(String key : map.keySet()) {
            System.out.println(map.get(key));
        }
        map.remove("1"); //删除键值为key的value返回被删除的value
        for(String key : map.keySet()) {
            System.out.println(map.get(key)); //根据Key获取value
        }
        Collection<String> keys = map.values();
        System.out.println("================");
        keys.forEach(System.out::println);
    }
}
